package org.jeecg.modules.bookmarks.service.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.bookmarks.entity.Bookmark;
import org.jeecg.modules.bookmarks.mapper.BookmarkMapper;
import org.jeecg.modules.bookmarks.service.IBookmarkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 书签服务实现类
 *
 * @author: scott
 * @date: 2022年05月12日 4:37 下午
 */
@Slf4j
@Service
public class BookmarkServiceImpl extends ServiceImpl<BookmarkMapper, Bookmark> implements IBookmarkService {

    @Autowired
    private BookmarkMapper bookmarkMapper;

    /**
     * 根据markId获取书签详细信息
     *
     * @param markId ：书签Id
     * @return Bookmark实体类
     */
    @Override
    public Bookmark getBookmarkById(String markId) {
        return bookmarkMapper.getBookmarkById(markId);
    }

    /**
     * 获取所有书签列表
     *
     * @return List<Bookmark>
     */
    @Override
    public List<Bookmark> listAll() {
        return bookmarkMapper.listAll();
    }

    /**
     * 保存书签，新建书签
     *
     * @param bookmark
     */
    @Override
    public void saveBookmark(Bookmark bookmark) {
        this.save(bookmark);
    }

    @Override
    public void editBookmark(Bookmark bookmark) {
        this.updateById(bookmark);
    }
}
